package com.ckw.match.utils;

import com.ckw.question.pojo.MatchResult;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

public class SerializationUtils {
    private static final ObjectMapper objectMapper = new ObjectMapper();

    public static String serialize(MatchResult matchResult) throws IOException {
        return objectMapper.writeValueAsString(matchResult);
    }

    public static MatchResult deserialize(String serialized) throws IOException {
        return objectMapper.readValue(serialized, MatchResult.class);
    }
}